//
//  EnterViewController.m
//  UI_元旦豆瓣电影
//
//  Created by 陆静聪 on 16/1/3.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "EnterViewController.h"
#import "LTView.h"
#import "RegisterViewController.h"
@interface EnterViewController ()

@end

@implementation EnterViewController

- (void)dealloc {
    [super dealloc];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.translucent = NO;
    self.navigationItem.title = @"用户登录";
    
    [self informate];
}

- (void)informate {
    LTView *LT1 = [[LTView alloc] initWithFrame:CGRectMake(10, 80, 300, 30)];
    LT1.myLabel.text = @"用户名";
    LT1.myTextField.placeholder = @"请输入用户名";
    [self.view addSubview:LT1];
    [LT1 release];
    
    LTView *LT2 = [[LTView alloc] initWithFrame:CGRectMake(10, 150, 300, 30)];
    LT2.myLabel.text = @"密码";
    LT2.myTextField.placeholder = @"请输入密码";
    [self.view addSubview:LT2];
    [LT2 release];
    
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
                         button1.frame = CGRectMake(60, 250, 100, 50);
    button1.backgroundColor = [UIColor greenColor];
    [button1 setTitle:@"登陆" forState:UIControlStateNormal];
    [button1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(b1Action:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button1];
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
    button2.frame = CGRectMake(200, button1.frame.origin.y, 100, 50);
    button2.backgroundColor = [UIColor orangeColor];
    [button2 setTitle:@"注册" forState:UIControlStateNormal];
    [button2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button2 addTarget:self action:@selector(b2Action:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button2];
    
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(iAction:)];
    self.navigationItem.leftBarButtonItem = item;
    [item release];
}

- (void)iAction:(UIBarButtonItem *)bu {
//    [self.navigationController popViewControllerAnimated:YES];
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

- (void)b1Action:(UIButton *)bu {
    
}

- (void)b2Action:(UIButton *)bu {
    RegisterViewController *RVC = [[RegisterViewController alloc] init];
    [self.navigationController pushViewController:RVC animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
